import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter/cupertino.dart';

import 'LFormMonthLogic.dart';
import 'LFormMonthState.dart';


class LFormMonthPage extends StatelessWidget {

  const LFormMonthPage({super.key, required this.tag});
  final String tag;

  @override
  Widget build(BuildContext context) {
    final LFormMonthState state = Get.find<LFormMonthLogic>(tag: tag).state;

    return GetBuilder<LFormMonthLogic>(
        // assignId:true,
        // autoRemove:true,
        tag: tag,
        // id: state.id,
        builder: (logic){
          return TextFormField(
            readOnly: true,
            controller: TextEditingController.fromValue(TextEditingValue(text:state.defaultText)),
            decoration: const InputDecoration(
              hintText: "请选择",
              enabledBorder: InputBorder.none,
              disabledBorder: InputBorder.none,
              focusedBorder: InputBorder.none,
            ),
            onChanged:(v){},
            onSaved: (v){},
            validator: (v) {
              return logic.onValidator(v);
            },
            onTap: (){
              //底部弹出
              if(state.formItem["readonly"]!=true){
                logic.showDataPicker(context);
              }
            },
          );
        }
    );
  }

}